package net.huashitong.Indicators.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import net.huashitong.Indicators.dao.AB02Dao;
import net.huashitong.Indicators.dto.AB01DTO;
import net.huashitong.Indicators.dto.AB02DTO;
import net.huashitong.Indicators.dto.BA01DTO;
import net.huashitong.Indicators.dto.StudentDTO;
import net.huashitong.Indicators.entity.AB02;
import net.huashitong.Indicators.entity.BA02;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AB02Service extends StringPKService<AB02> {

    @Autowired
    private AB02Dao dao;


    @Override
    protected BaseDao<AB02, String> getDao() {
        return dao;
    }


    @Override
    protected void beforeSave(AB02 obj) {
        obj.setSysId(dao.getSequence("SEQ_BAB001"));
    }


    public List<AB01DTO> getBettingRank(String name, String courseId)
    {
        return dao.getBettingRank(name,courseId);
    }

    @Override
    public AB02 getById(String id) {
        return super.getById(id);
    }


    public AB02 getBetRecord(String aab001,String bab001,String aab998)
    {
        return dao.getBetRecode(aab001,bab001,aab998);
    }

    public  List<StudentDTO> getOwerCourse(StudentDTO dto)
    {
        return dao.getOwnerCourse(dto);
    }

    public List<StudentDTO> getCourseRank(StudentDTO dto)
    {
        return dao.getCourseRank(dto);
    }

    /**
     *
     * @param bab001 课程ID
     * @param bab003 课程名额
     */
    public void batchAccount(String bab001,String bab003,String bab205)
    {
        dao.batchOverCourse(bab001,bab003, bab205);
    }


    public void deleteAll()
    {
        dao.deleteAllAb02();
    }

    public  List<StudentDTO> getRank2(StudentDTO dto)
    {
        return  dao.getCourseRank2(dto);
    }


}
